package com.elite.groovy.callback

import com.elite.groovy.util.EliteBean
import org.apache.commons.logging.Log
import org.apache.commons.logging.LogFactory
import org.springframework.jdbc.core.JdbcTemplate

import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

/**
 *
 * @Title: autoClearYpfQuotaConfig*
 * @Description:清空预评分配额,每月1号晚上0点执行
 * @remak ：预评分清空预评分配额*
 * @author: TH*
 * @date 2023-12-13 11:11:00
 *
 */
public  class autoClearYpfQuotaConfig  implements ServiceBackInvoke{
    private static final Log log = LogFactory.getLog(autoClearYpfQuotaConfig.class);

    @Override
    public String doCallBack(EliteBean eliteBean, HttpServletRequest request, HttpServletResponse response) {
        JdbcTemplate jt = new JdbcTemplate(eliteBean.getDataSource());

        long starttime = System.currentTimeMillis();
        try {

            String Updatesql = ''' 
                         Update
                        push_h5_quota_config 
                        Set
                        USED_TOTAL=0,
                        SY_TOTAL= TOTAL     
                            
                      ''';

            jt.update(Updatesql);


        }  catch (Exception e) {
                log.error("【预评分】清空预评分配额异常：" + e.getMessage());


            }


        long endtime = System.currentTimeMillis();

        log.debug("【预评分清空配额】耗时(毫秒)："+(endtime-starttime));
    }


}
